import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入layout组件
import layout from '../views/layout.vue'
// 导入登陆组件
import login from '../views/login/login.vue'
// 导入发现组件
import find from '../views/find/find.vue'
// 导入我的组件
import my from '../views/my/my.vue'
// 导入公司组件
import company from '../views/company/company.vue'
// 导入刷题组件
import shuati from '../views/shuati/shuati.vue'


Vue.use(VueRouter)

const routes = [
  {
    name: 'login',
    path: '/login',
    component: login
  },
  {
    name: 'layout',
    path: '/',
    component: layout,
    // 二级路由
    children: [
      {
        name: 'find',
        path: '/find',
        component: find
      },
      {
        name: 'my',
        path: '/my',
        component: my
      },
      {
        name: 'company',
        path: '/company',
        component: company
      },
      {
        name: 'shuati',
        path: '/shuati',
        component: shuati,
      },
      {
        path: '/',
        redirect: '/my'
      }
    ]
  }
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
